﻿<UserControl x:Class="XamlHelpmeet.UI.Editors.DynamicFormDatePickerEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:cvtrs="clr-namespace:XamlHelpmeet.UI.Converters"
             xmlns:local="clr-namespace:XamlHelpmeet.UI.Editors"
             xmlns:vrules="clr-namespace:XamlHelpmeet.UI.ValidationRules">
    <UserControl.Resources>
        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>

        <cvtrs:BindingModeEnumConverter x:Key="bindingModeEnumConverter" />

    </UserControl.Resources>

    <DockPanel Margin="3">
        <TextBlock Width="40" Text="Label" />
        <TextBox Width="125"
                 HorizontalAlignment="Left"
                 TabIndex="1"
                 Text="{Binding Path=AssociatedLabel,
                                Mode=TwoWay}" />

        <TextBox Width="50"
                 VerticalAlignment="Top"
                 DockPanel.Dock="Right"
                 TabIndex="2">
            <TextBox.Text>
                <Binding Mode="TwoWay"
                         Path="Width"
                         TargetNullValue=""
                         UpdateSourceTrigger="LostFocus"
                         ValidatesOnDataErrors="True"
                         ValidatesOnExceptions="True">
                    <Binding.ValidationRules>
                        <vrules:PositiveIntegerValidationRule />
                    </Binding.ValidationRules>
                </Binding>
            </TextBox.Text>
        </TextBox>

        <TextBlock Margin="15,0,5,0"
                   HorizontalAlignment="Right"
                   DockPanel.Dock="Right"
                   Text="Width" />

    </DockPanel>

</UserControl>
